#include <cstdio>
#include <cmath>
#define eps 1e-7

double x[ 10001 ], y[ 10001 ], maxy;
int n;

void init( )
{
    double xx, yy, zz;
    int i;
    scanf("%d", &n);
    for ( i = 0; i < n; i++ )
    {
        scanf("%lf%lf%lf", &xx, &yy, &zz);
        x[ i ] = sqrt( xx * xx + yy * yy );
        y[ i ] = zz;
        if ( maxy < zz ) maxy = zz;
    }
}

double calc( double h )
{
    double xx = 0, yy = 0, d;
    int i;
    for ( i = 0; i < n; i++ )
        if ( xx * ( y[ i ] - h ) - x[ i ] * ( yy - h ) > 0 )
        {
            xx = x[ i ];
            yy = y[ i ];
        }
    d = h / ( h - yy ) * xx;
    return d * d * h;
}

void work( )
{
    double left = maxy + eps, right = 1000000, mid1, mid2;
    while ( 1 )
    {
        mid1 = left + ( right - left ) / 3;
        mid2 = left + ( right - left ) / 3 * 2;
        if ( mid2 - mid1 < eps )
            break;
        if ( calc( mid1 ) > calc( mid2 ) )
            left = mid1;
        else
            right = mid2;
        //printf("%lf %lf\n", calc( mid1 ), calc( mid2 ));
    }
    double h = mid1, xx = 0, yy = 0, d;
    int i;
    for ( i = 0; i < n; i++ )
        if ( xx * ( y[ i ] - h ) - x[ i ] * ( yy - h ) > 0 )
        {
            xx = x[ i ];
            yy = y[ i ];
        }
    d = h / ( h - yy ) * xx;
    printf("%.3lf %.3lf\n", mid1, d);
}

int main( )
{
    int t;
    scanf("%d", &t);
    while( t-- )
    {
        init( );
        work( );
    }
    return 0;
}
